package com.xlabs.client.DTO;

import com.google.gwt.user.client.rpc.IsSerializable;

import java.util.Date;
import java.io.Serializable;

/**
 * Question data tranfer object.
 */
public class QuestionDTO implements Serializable, IsSerializable {
    /**
     * The text comment.
     */
    private String questionText;

    /**
     * The start time of video in seconds to which this question relates. 
     */
    private Integer startTime;

    /**
     * The end time of video in seconds to which this question relates.
     */
    private Integer endTime;

    /**
     * When created.
     */
    private Date createdOn;

    /**
     * Created by user.
     */
    private String createdBy;

    /**
     * Encoded key of the corresponding data object.
     */
    private String encodedKey;

    /**
     * Initializes an instance of TimedComment.
     *
     * @param questionText The comment.
     * @param startTime the start of corresponding video interval.
     * @param endTime the end of corresponding video interval.
     */
    public QuestionDTO(String questionText, int startTime, int endTime, Date createdOn) {
        if (endTime < startTime) {
            throw new IllegalArgumentException("startTime should be less than or equal to endTime");
        }

        this.questionText = questionText;
        this.startTime = startTime;
        this.endTime = endTime;
        this.createdOn = createdOn;
    }

    /**
     * Public no-arg contructor.
     */
    public QuestionDTO() {
    }

    /**
     * Gets question text.
     *
     * @return question text.
     */
    public String getQuestionText() {
        return this.questionText;
    }

    /**
     * Sets question text.
     *
     * @param questionText The text comment.
     */
    public void setQuestionText(String questionText) {
        this.questionText = questionText;
    }

    /**
     * Gets createdOn.
     * @return time of creation.
     */
    public Date getCreatedOn() {
        return createdOn;
    }

    /**
     * Sets time of creation.
     * @param createdOn time of creation.
     */
    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     * Gets createdBy.
     * @return creator.
     */
    public String getCreatedBy() {
        return createdBy;
    }

    /**
     * Sets createdBy.
     * @param createdBy creator.
     */
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }
    
    /**
     * Gets {@link #startTime}
     * @return {@link #startTime}
     */
    public Integer getStartTime() {
        return startTime;
    }

    /**
     * Sets {@link #startTime}
     * @param startTime {@link #startTime}
     */
    public void setStartTime(Integer startTime) {
        this.startTime = startTime;
    }

    /**
     * Gets {@link #endTime}
     * @return {@link #endTime}
     */
    public Integer getEndTime() {
        return endTime;
    }

    /**
     * Sets {@link #endTime}
     * @param endTime {@link #endTime}
     */
    public void setEndTime(Integer endTime) {
        this.endTime = endTime;
    }

    /**
     * Gets {@link #encodedKey}
     * @return {@link #encodedKey}
     */
    public String getEncodedKey() {
        return encodedKey;
    }

    /**
     * Sets {@link #encodedKey}
     * @param encodedKey {@link #encodedKey}
     */
    public void setEncodedKey(String encodedKey) {
        this.encodedKey = encodedKey;
    }
}
